home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Demos / Simpsons Cartoon Studio™ Demo / Simpdata / simpmain / 00017_soundFXRecordManager parent.ls < prev    next >
Encoding:
Text File  |  1996-09-06  |  2.2 KB  |  79 lines

  1. property ancestor
  2. global frameLimit, currentFrame, dirtyFlag
  3.  
  4. on birth me
  5.   set the ancestor of me to birth(script "recordMethods parent")
  6.   return me
  7. end
  8.  
  9. on record me
  10.   buildFilterList(me)
  11.   set countSoundFXData to count(soundFXData)
  12.   if countSoundFXData < currentFrame then
  13.     repeat with theFrameCounter = countSoundFXData + 1 to currentFrame
  14.       append(soundFXData, copyList([EMPTY, 0]))
  15.     end repeat
  16.   end if
  17.   set theSoundName to getAt(curClipRecord, 2)
  18.   set theSoundCastNum to getAt(curClipRecord, 3)
  19.   preLoadCast(theSoundCastNum)
  20.   set overFlow to 0
  21.   if currentFrame < frameLimit then
  22.     if currentFrame > count(scoreData) then
  23.       setAt(scoreData, currentFrame, copyList(autoHoldFrame))
  24.     end if
  25.     setAt(soundFXData, currentFrame, copyList([EMPTY, 0]))
  26.     setKrusty(playbackMgr)
  27.     showFrame(playbackMgr, currentFrame, 0)
  28.     incrementFrame()
  29.   else
  30.     set overFlow to 1
  31.   end if
  32.   if theSoundCastNum > 16000 then
  33.     set numberOfSndFrames to (the size of cast theSoundCastNum / 22050.0 * 12.0) + 10
  34.   else
  35.     set numberOfSndFrames to (the size of cast theSoundCastNum / 11025.0 * 12.0) + 10
  36.   end if
  37.   puppetSound(2, theSoundCastNum)
  38.   repeat with i = 1 to numberOfSndFrames
  39.     if currentFrame < frameLimit then
  40.       startTimer()
  41.       if currentFrame > count(scoreData) then
  42.         setAt(scoreData, currentFrame, copyList(autoHoldFrame))
  43.       end if
  44.       setAt(soundFXData, currentFrame, list(theSoundName, theSoundCastNum))
  45.       setKrusty(playbackMgr)
  46.       showFrame(playbackMgr, currentFrame, 0)
  47.       incrementFrame()
  48.       repeat while the timer < 6
  49.       end repeat
  50.       next repeat
  51.     end if
  52.     set overFlow to 1
  53.     exit repeat
  54.   end repeat
  55.   if currentFrame < frameLimit then
  56.     if currentFrame > count(scoreData) then
  57.       setAt(scoreData, currentFrame, copyList(autoHoldFrame))
  58.     end if
  59.     setAt(soundFXData, currentFrame, copyList([EMPTY, 0]))
  60.     setKrusty(playbackMgr)
  61.     showFrame(playbackMgr, currentFrame, 0)
  62.     incrementFrame()
  63.   else
  64.     set overFlow to 1
  65.   end if
  66.   if overFlow then
  67.     showOverFlowDialog(me)
  68.   end if
  69.   extendClips(me)
  70.   if currentFrame > 1 then
  71.     decrementFrame()
  72.   end if
  73.   setKrusty(playbackMgr)
  74.   showFrame(playbackMgr, currentFrame, 0)
  75.   set dirtyFlag to 1
  76.   updateTheBrain(appMgr)
  77.   cursor(-1)
  78. end
  79.